/************************************
 * Package: RGcpp					*
 * Authors: Rui Eduardo Gouveia Gil	*
 * Date: 2010						*
 ************************************/
#ifndef __RGCPP_SHAGENERATOR_H__
#define __RGCPP_SHAGENERATOR_H__

#include <openssl/sha.h>

#include "rgcpp/exceptions/RuntimeException.h"

#define SHA_DIGEST_SIZE 32

namespace rgcpp
{

class SHAGenerator
{
	private:
		bool state;
		SHA256_CTX sha_ctx;

	public:
		SHAGenerator();
		~SHAGenerator();

		void init();
		void update(const char* data, const unsigned length);
		void digest(char* digest);

		static void digest(const char* data, const unsigned int length, char* digest);
};

}

#endif
